from time import sleep

import page
from base.base import Base
from tool.get_log import GetLogger

log = GetLogger().get_log()

class PageShop(Base):

    def pageshop_click_shop(self):
        self.base_click_element(page.wd_shop)

    def pageshop_get_page_title(self):
        sleep(5)
        return self.base_get_element_text(page.shop_title)

    def pageshop_return_to_wdpage_keycode(self):
        for a in range(10):
            log.info(f'正在返回我的页面，第{a + 1}次尝试')
            if self.base_if_element_exist(page.wd_tab):
                break
            else:
                self.driver.press_keycode(4)
